package com.qst.dao;

import com.qst.pojo.Employee;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author Eumenides.
 * @create 2021-06-17 10:51
 */
@Repository
//@Mapper
public interface IEmployeeDao {
    /**
     * 查询所有员工信息
     *
     * @return java.util.List<com.qst.pojo.Employee>
     * @Param []
     * @author Eumenides
     */
//    @Select("select * from employee")
//    @Results(
//            @Result(property = "department", column = "departmentid", one = @One(select = "com.qst.dao.DepartmentDao.findDepartmentById"))
//    )
    List<Employee> findAll();

    /**
     * 查找某一个部门中的所有人
     * @return com.qst.pojo.Employee
     * @Param [did]
     * @author Eumenides
     */
//    @Select("select * from employee where departmentid = #{did}")
    List<Employee> findEmployeeByDepartmentId(Integer did);

    /**
     * 通过员工用户名查询
     *
     * @return com.qst.pojo.Employee
     * @Param [username]
     * @author Eumenides
     */
//    @Select("select * from employee where username = #{username}")
    Employee findEmployeeByName(String username);

    /**
     * 判断username，phone,email是否已被使用
     *
     * @return java.util.List<com.qst.pojo.Employee>
     * @Param [employee]
     * @author Eumenides
     */
    int insertEmployee(Employee employee);

    /**
     * 根据用户名，账号名查询员工信息
     * @param employee
     * @return
     */
    List<Employee> findEmployeeBynameWithId(Employee employee);

    /**
     * 根据meetingid查询参会人员
     * @param meetingid
     * @return
     */
    List<Employee> findEmployee(Integer meetingid);

    /**
     * 判断是否有重复用户名
     * @return java.util.List<com.qst.pojo.Employee>
     * @Param [employee]
     * @author Eumenides
     */
    Integer judgeUsername(String username);

    /**
     * 判断是否有重复手机号
     * @return java.lang.Integer
     * @Param [phone]
     * @author Eumenides
     */
    Integer judgePhone(String phone);

    /**
     * 判断是否有重复电子邮箱
     * @return java.lang.Integer
     * @Param [email]
     * @author Eumenides
     */
    Integer judgeEmail(String email);
}
